package com.zt.controller;

import com.zt.service.LoanService;
import com.zt.system.Loan;
import com.zt.utils.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("loan")
public class LoanController {
    @Resource
    private LoanService loanService;
//    查询自己所有已通过的贷款
    @GetMapping("loanFindByUserId")
    public List<Loan> loanFind(){return loanService.loanFindByUserId();}
//    还款
    @GetMapping("loanByLoanId")
    public Result loanByLoanId(Integer loanId){
        System.out.println(loanId);
        return loanService.loanByLoanId(loanId);
    }
//    还款 -- 操作 银行卡表 贷款表
    @GetMapping("loanUpdate")
    public Result loanUpdate(Loan loan){
        System.out.println(loan);
        return loanService.loanUpdate(loan);
    }
}
